package com.vn.ducktohome.screen;

import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction;
import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction;
import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.vn.ducktohome.gamelogic.GameControl;

public class TestScreen extends BaseScreen {

	private Image duck;
	private MoveToAction m1, m2;
	private SequenceAction s;
	private RepeatAction r;
	
	@Override
	public void show() {
		super.show();
		duck = new Image(GameControl.getAtlas().findRegion("play/duck", 1));
		stage.addActor(duck);
		initAct();
	}
	
	private void initAct(){
		m1 = new MoveToAction();
		m1.setX(100);
		m1.setDuration(2f);
		
		m2 = new MoveToAction();
		m2.setX(0);
		m2.setDuration(2f);
		
		s = new SequenceAction();
		s.addAction(m1);
		s.addAction(m2);
		
		r = new RepeatAction();
		r.setAction(s);
		r.setCount(RepeatAction.FOREVER);
		
		duck.addAction(r);
	}

	@Override
	public void render(float arg0) {
		super.render(arg0);
//		Gdx.app.log(String.valueOf(m1.getTime()), String.valueOf(m1.getDuration()));
//		if (m1.getTime() >= m1.getDuration())
//			Gdx.app.log("", "isdone");
	}

	@Override
	public void dispose() {
		super.dispose();
	}
}
